﻿using SpaceNeedle.x6473.WindowsPhone.Common;
using SpaceNeedle.SDK.Windows.Platform.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpaceNeedle.x6473.WindowsPhone.Common
{
    public class Program : BindableBase
    {
        public Program()
        {
            this.Values = new Dictionary<string, object>();
            this.Settings = new Dictionary<string, string>();
        }

        private string id;

        public string Id
        {
            get { return id; }
            set
            {
                this.SetProperty(ref id, value);
            }
        }

        private string title;

        public string Title
        {
            get { return title; }
            set
            {
                this.SetProperty(ref title, value);
            }
        }

        private string subtitle;

        public string Subtitle
        {
            get { return subtitle; }
            set
            {
                this.SetProperty(ref subtitle, value);
            }
        }

        private bool canShotSubtitle;

        public bool CanShotSubtitle
        {
            get { return canShotSubtitle; }
            set
            {
                this.SetProperty(ref canShotSubtitle, value);
            }
        }

        private string description;

        public string Description
        {
            get { return description; }
            set
            {
                this.SetProperty(ref description, value);
            }
        }

        private string presenter;
        public string Presenter
        {
            get { return presenter; }
            set
            {
                this.SetProperty(ref presenter, value);
            }
        }

        private TimeSpan time;
        public TimeSpan Time
        {
            get { return time; }
            set
            {
                this.SetProperty(ref time, value);
            }
        }

        private Dictionary<string, string> settings;
        public Dictionary<string, string> Settings
        {
            get { return this.settings; }
            set
            {
                this.SetProperty(ref settings, value);
            }
        }

        private Dictionary<string, object> values;
        public Dictionary<string, object> Values
        {
            get { return this.values; }
            set
            {
                this.SetProperty(ref values, value);
            }
        }

        public string GetSetting(string key)
        {
            if (this.Settings == null)
            {
                return string.Empty;
            }

            if (this.Settings.ContainsKey(key))
            {
                return this.Settings[key];
            }

            return string.Empty;
        }

        public string GetStringValue(string key)
        {
            if (this.Values == null)
            {
                return string.Empty;
            }

            if (this.Values.ContainsKey(key))
            {
                object value = this.Values[key];

                if (value != null)
                {
                    return value.ToString();
                }
            }

            return string.Empty;
        }

        public object GetObjectValue(string key)
        {
            if (this.Values == null)
            {
                return null;
            }

            if (this.Values.ContainsKey(key))
            {
                object value = this.Values[key];

                if (value != null)
                {
                    return value;
                }
            }

            return null;
        }
    }
}
